<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
	<meta http-equiv="x-rim-auto-match" content="none">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>商家详情</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="__PUBLIC__/Css/shop.css" rel="stylesheet">

</head>
<body>
	<!-- <nav class="navbar navbar-fixed-top header">
	    <div class="container">
		    <div class="pull-left" >
		  		<button class="btn btn-default">
                	<span class='glyphicon glyphicon-menu-left'></span>
            	</button>
		 	</div>
		  	<div class="pull-right">
		  		<button  class="btn pull-right sign" id="sign">签到</button>
		  	</div>
		  	<div class="pull-right share">
		  		<button class="btn btn-default" id="collect">
                	<span class='glyphicon glyphicon-star-empty'></span>
            	</button>
		  	</div>
	  </div>
	</nav> -->

	<nav class="container-fluid navbar navbar-inverse " style="margin-bottom:0;">
       <div class="navbar-header">
         <div class="navbar-brand" >
         	<a href="__CONTROLLER__/shopSelect" style="text-decoration: none"><span class="glyphicon glyphicon-arrow-left" style="color:#9d9d9d;"></span>
         	<span style="color:#9d9d9d;">商户列表</span></a>
         </div>
		  		<button  class="btn  sign" id="sign" style="margin-top:7px;margin-left:60px;">签到</button>
		  	
		  		<button class="btn btn-default" id="collect" style="font-size:17px;margin-top:7px;">
                	<span class='glyphicon glyphicon-star-empty'></span>
            	</button>
		  	
        </div>
  	</nav>

	<div class="container-fluid banner">
		<div class="row">
		  <img src="{$shopinfor[0].shopimg}" class="img-responsive center-block" alt="外婆家"/>
		</div>
		<div class="row">
		  <div class="col-xs-12 shop">
		  	<div class="pull-left" >
		  		<span class="shopname">{$shopinfor[0].shopname}</span>
		  	</div>
		  	<!-- <div class="pull-left sign"><span >今日签到</span></div> -->
		  	<div class="pull-right star" id="star" style="color:#9F2D20;">
		  	</div>
		  </div>
		</div>	

	  </div>

	  <div class="container" >
	  	<div class="row address">
		  	<div class="col-xs-1" ><span class="glyphicon glyphicon-map-marker"></span></div>
		  	<div class="col-xs-10" ><span>{$shopinfor[0].address}</span></div>
		  	<div class="col-xs-1 right"><span class="glyphicon glyphicon-menu-right"></span></div>
		</div>
		<div class="row tel">
		  	<div class="col-xs-1" ><span class="glyphicon glyphicon-earphone"></span></div>
		  	<div class="col-xs-10"><a href="tel:{$shopinfor[0].phone}" style="text-decoration: none">{$shopinfor[0].phone}</a></div>
		  	<div class="col-xs-1 right"><span class="glyphicon glyphicon-menu-right"></span></div>
		</div>
	  </div>

	  <div class="container">
	  <volist name="couponinfor" id="vo">
	  <a href="__CONTROLLER__/showPD/id/{$vo.id}/shopid/{$vo.buss}">
	  	<div class="row discounts">
	  		<div class="col-xs-4 saleimg">
	  			<img src="{$vo.image}" class="img-responsive" alt="外婆家"/>
	  		</div>
	  		<div class="col-xs-8 saleinfor">
		  			<div class="col-xs-12">
		  				<span>{$vo.context}</span>
		  			</div>
		  			<div class="col-xs-12">
			  			<div class="row price">
		  					<div class="col-xs-10 pull-left">
		  						<span class="nowprice">￥<span>{$vo.now_price}</span></span>
		  						<s><span>{$vo.used_price}</span></s>
		  						<span class="benefit">立减<span>{$vo["used_price"]-$vo["now_price"]}</span></span>
		  					</div>
		  					<div class="col-xs-2 text-right right">
		  						<span class="glyphicon glyphicon-menu-right"></span>
		  					</div>
			  			</div>
		  			</div>
	  			
	  		</div>

	  	</div>
	  	</a>
	  </volist>
	  </div>

	  <div class="container">
	  	<div class="row judge">
		  	<div class="col-xs-1" ><span class="glyphicon glyphicon-flag"></span></div>
		  	<div class="col-xs-11"><span>评价</span></div>
	  </div>
	  <volist name="commentinfor" id="vol">
	  	<div class="media review">
			  <div class="media-left media-top">
			      <img class="media-object img-responsive img-circle" src="{$vol.user.headimgurl}" alt="...">
			  </div>
			  <div class="media-body">
			  	<h4 class="media-heading">
			  		{$vol.user.nickname}<span class="reviewtime">{$vol.time}</span>
			  	</h4>
			    <span>{$vol.context}</span>
			  </div>
		</div>
	  </volist>
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"> </script>
    <script >
    	//根据后台传来的评分显示星星个数
    	for(var i=0;i<'{$score}';i++){
    		$star=$('<span class="glyphicon glyphicon-star"></span>');
    		$star.appendTo($("#star"));
    	}

    	//能否签到
    	if ('{$signinfor}'==0 || '{$signinfor}'>6) {      //用户从未签到或距离上次签到大于6小时时，用户可签到
    		$("#sign").css({"background-color":"#337ab7","border-color":"#2e6da4"});
    		console.log('{$signinfor}');
    		$("#sign").on("click",function(){
    			
    		window.location="__MODULE__/Comment/comment";
    			

    		});
    	}else{
    		$("#sign").css({"background-color":"#d7d7d7","border-color":"#ccc"});
    		// alert('不可以')
    	}

    	// alert('{$collection}')
    	var $openid='{$openid}';
    	var $shopid='{$shopinfor[0].bs_id}';
    	// alert($shopid)

    	//判断用户是否收藏该商家
    	if (!'{$collection}') {		//用户能收藏
    		$("#collect").css({"background-color":"#337ab7","border-color":"#2e6da4"});
    		$("#collect").on("click",function(){
    			var $jsonobj={"openid":$openid,"shopid":$shopid};  
    			$.ajax({                                    
			        type:"post",
			        url:"__CONTROLLER__/shopCollect/",
			        dataType:"json",
			        data:$jsonobj,
			        success:function(data){
			        	// alert(data['results'])
			        	if (data['results']=="1") {
			        		alert("收藏成功");
			        		location.reload();
			        		// $("#collect").css({"background-color":"#d7d7d7","border-color":"#ccc"});
			        	}
			        	else{
			        		alert("收藏失败");
			        	}
			        },
			        error:function(XMLResponse,err){
			            console.log(err);
			        },
				});
    		});
    				
    	}else{
    		$("#collect").css({"background-color":"#d7d7d7","border-color":"#ccc"});
    		
    	}
    </script>
</body>
</html>